/*    */ package com.zimbra.cs.dav.service.method;
/*    */ 
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.common.util.Log;
/*    */ import com.zimbra.common.util.ZimbraLog;
/*    */ import com.zimbra.cs.dav.DavContext;
/*    */ import com.zimbra.cs.dav.DavContext.RequestProp;
/*    */ import com.zimbra.cs.dav.DavElements;
/*    */ import com.zimbra.cs.dav.DavException;
/*    */ import com.zimbra.cs.dav.resource.CalendarCollection;
/*    */ import com.zimbra.cs.dav.resource.DavResource;
/*    */ import com.zimbra.cs.dav.service.DavResponse;
/*    */ import java.util.ArrayList;
/*    */ import org.dom4j.Document;
/*    */ import org.dom4j.Element;
/*    */ import org.dom4j.QName;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class CalendarMultiget
/*    */   extends Report
/*    */ {
/*    */   public void handle(DavContext ctxt)
/*    */     throws ServiceException, DavException
/*    */   {
/* 45 */     Element query = ctxt.getRequestMessage().getRootElement();
/* 46 */     if (!query.getQName().equals(DavElements.E_CALENDAR_MULTIGET)) {
/* 47 */       throw new DavException("msg " + query.getName() + " is not calendar-multiget", 400, null);
/*    */     }
/* 49 */     DavResponse resp = ctxt.getDavResponse();
/* 50 */     ArrayList<String> hrefs = new ArrayList();
/* 51 */     for (Object obj : query.elements(DavElements.E_HREF))
/* 52 */       if ((obj instanceof Element))
/* 53 */         hrefs.add(((Element)obj).getText());
/* 54 */     long ts = System.currentTimeMillis();
/* 55 */     DavResource reqResource = ctxt.getRequestedResource();
/* 56 */     if (!(reqResource instanceof CalendarCollection))
/* 57 */       throw new DavException("requested resource is not a calendar collection", 400, null);
/* 58 */     CalendarCollection calResource = (CalendarCollection)reqResource;
/* 59 */     long now = System.currentTimeMillis();
/* 60 */     ZimbraLog.dav.debug("GetRequestedResource: " + (now - ts) + "ms");
/* 61 */     DavContext.RequestProp reqProp = ctxt.getRequestProp();
/* 62 */     for (DavResource rs : calResource.getAppointmentsByUids(ctxt, hrefs))
/* 63 */       resp.addResource(ctxt, rs, reqProp, false);
/* 64 */     ts = now;
/* 65 */     now = System.currentTimeMillis();
/* 66 */     ZimbraLog.dav.debug("multiget: " + (now - ts) + "ms");
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/dav/service/method/CalendarMultiget.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */